import NoticeEvents from '@/event/noticeEvents'
import { notification } from 'ant-design-vue'
import { useNoticeStoreHook } from '@/stores/modules/notice'

NoticeEvents.on('on:system:message', (data) => {
  const notificationSound = new Audio('/notice.mp3')
  notificationSound.play().catch((error) => {
    console.error('播放音效时发生错误:', error)
  })
  useNoticeStoreHook().getByUserMessage()
  notification.open({
    message: data.title
  })
})
